package com.example.jmeter.controller;

import com.example.jmeter.dependent.SoftDependInstall;
import com.example.jmeter.entity.HTTPSampler;
import com.example.jmeter.entity.TestPlan;
import com.example.jmeter.entity.ThreadGroup;
import com.example.jmeter.enums.DependType;
import com.example.jmeter.enums.JmeterCommand;
import com.example.jmeter.enums.JmxTemplate;
import com.example.jmeter.service.JmeterService;
import org.springframework.web.bind.annotation.RestController;

/**
 * @program: spring-agent
 * @description:
 * @author: zt22328 赵儒定
 * @create: 2023-04-19 16:13
 **/
@RestController
public class JmeterController {


    public static void main(String[] args) {
        JmeterService js = new JmeterService();

        TestPlan testPlan = new TestPlan("测试计划");
        testPlan.setComments("demo测试");

        ThreadGroup threadGroup1 = new ThreadGroup("分组1", 10, 10);

        threadGroup1.addHttpSampler(
                new HTTPSampler("百度", "www.baidu.com"),
                // https://test-open.eminxing.com/openapi/api/openapi-api/document/api/dictionary
                new HTTPSampler("OpenApi", "test-open.eminxing.com", "/openapi/api/openapi-api/document/api/dictionary"));

        testPlan.addThreadGroup(threadGroup1);

        js.generateJmx(testPlan, JmxTemplate.HTTP);

        js.execute(testPlan.getName());

    }

}
